<!--  -->




<!--          :centered='true'-->
<!--          price="0"-->
<!--          :origin-price='item.goods.goodsMarketPrice'-->
<!--          :desc="item.goods.goodsDesc"-->
<!--          :title="item.goods.goodsName"-->
<!--          :thumb="'http://172.17.4.241/8887/upload/'+item.goods.goodsImg"-->
<template>
    <div>
        <van-nav-bar title="我的助力" fixed placeholder left-arrow
                     @click-left="$router.back()"/>
        <div>
            <van-card
                    v-for="item in helpList"
                    :key="item.goodsId"
                    :centered='true'
                    price="0"
                    :desc="helpList.goodsDesc"
                    :title="helpList.goodsName"
                    :thumb="'http://172.17.4.241/8887/upload/'+helpList.goodsImg"

            >
                <template #price-top>
                    <div v-if="(new Date(item.help.helpEndTime)).getTime()-new Date().getTime()>0">
                        距离助力结束还剩
                        <van-count-down :time="(new Date(item.help.helpEndTime)).getTime()-new Date().getTime()" format="DD 天 HH 时 mm 分 ss 秒" />
                        <div  v-if="item.helpTeamNum-item.helpTeamUserR.length>0">还需要<span class="red">{{item.helpTeamNum-item.helpTeamUserR.length}}人 </span> 助力</div>
                    </div>

                </template>



                <template #footer v-if="item.helpTeamNum>item.helpTeamUserR.length&&(new Date(item.help.helpEndTime)).getTime()-new Date().getTime()>0" >
                    <van-button size="small" icon="arrow" icon-position="right" color="linear-gradient(to right, #ff6034, #ee0a24)">继续分享</van-button>
                </template>
                <template #footer v-if="item.helpTeamNum<=item.helpTeamUserR.length&&(new Date(item.help.helpEndTime)).getTime()-new Date().getTime()>0">
                    <van-button size="small" icon="arrow" icon-position="right" color="linear-gradient(to right, #ff6034, #ee0a24)">助力成功</van-button>
                </template>
                <template #footer v-if="item.helpTeamNum>item.helpTeamUserR.length&&(new Date(item.help.helpEndTime)).getTime()-new Date().getTime()>0">
                    <van-button size="small" icon="arrow" icon-position="right" color="linear-gradient(to right, #ff6034, #ee0a24)">助力失败</van-button>
                </template>


            </van-card>
        </div>
    </div>
</template>

<script>
    export default {
        name:'myHelp',
        data () {
            return {
                helpList:[],
                userId:1
            }
        },
        created(){
            // this.userId=JSON.parse(sessionStorage.getItem('user')).userId
            this.getHelpGoods()
        },
        methods:{
            getHelpGoods(){
                var userId = sessionStorage.getItem('userId');
                this.$axios.post('/api/marketHelp/userGettHelp?userId='+userId).then(res=>{
                    console.log('个人助力信息')
                    // console.log(res)
                    if(res.data.code==200){
                        this.helpList=res.data.data
                        console.log(this.helpList)
                    }else{
                        this.$toast.fail(res.data.msg)
                    }
                })
            },
        }
    }
</script>

<style  scoped>
    .red{
        color: red;
    }
</style>
